<template>
  <div>
    <!-- 面包屑导航区 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片视图 -->
    <el-card>

      <el-table :data="rightsList" stripe style="width: 100%" border>
        <el-table-column type="index" label="序号" width="80" align="center">
        </el-table-column>
        <el-table-column prop="authName" label="权限名称" width="width">
        </el-table-column>
        <el-table-column prop="path" label="路径" width="width">
        </el-table-column>
        <el-table-column prop="level" label="权限等级" width="width">
          <template slot-scope="{row}">
            <el-tag v-if="row.level=='0'">一级权限</el-tag>
            <el-tag v-else-if="row.level=='1'" type="success">二级权限</el-tag>
            <el-tag v-else type="danger">三级权限</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
  export default {
    name: "Rights",
    data() {
      return {
        //权限列表数据
        rightsList: []
      }
    },
    methods: {
      //获取列表数据
      async getRightsList() {
        let result = await this.$requests.get("rights/list")
        if (result.meta.status == 200) {
          this.rightsList = result.data
        }
      }
    },
    mounted() {
      this.getRightsList()
    }
  }

</script>

<style lang="less" scoped>

</style>
